package com.huawei.appmarket.service.appmgr.view.widget;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appmarket.service.appmgr.view.activity.InstallManagerCardBean;
import o.cke;
import o.Logger;
import o.dvt;

public class FeatureSupportDownloadButton extends DownloadButton {
    public FeatureSupportDownloadButton(Context context) {
        super(context);
    }

    public FeatureSupportDownloadButton(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public FeatureSupportDownloadButton(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public cke ॱ() {
        cke ॱ = super.ॱ();
        if (ͺ()) {
            setEnabled(false);
            if (this.ˎ == cke.PAUSE_DOWNLOAD_APP || this.ˎ == cke.WAIT_DOWNLOAD_APP) {
                setVisibility(0);
            } else {
                setVisibility(8);
            }
        }
        return ॱ;
    }

    public void ˏ(boolean z) {
        if (ͺ()) {
            setEnabled(false);
        } else {
            super.setEnabled(z);
        }
    }

    public void setDownloadProgress(int i) {
        setVisibility(0);
        super.setDownloadProgress(i);
    }

    public void ˎ() {
        if (!ͺ()) {
            super.ˎ();
        }
    }

    public void ˋ(Drawable drawable, int i) {
        if (!ͺ()) {
            super.ˋ(drawable, i);
        } else if (i >= 0 && i <= 100) {
            ˏ(1);
            setProgress(i);
        }
    }

    private boolean ͺ() {
        if (this.ˏ instanceof InstallManagerCardBean) {
            SessionDownloadTask ˎ = dvt.ˏ().ˎ(((InstallManagerCardBean) this.ˏ).ॱ());
            if (ˎ != null && ˎ.ˌ() == 9) {
                Logger.ˎ("FeatureSupportDownloadButton", "isFeatureDownload true");
                return true;
            }
        }
        return false;
    }
}
